package com.junxonline.plat.dao.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import javax.persistence.*;
import java.util.Date;
import java.util.List;

/**
 * @ClassName: Household
 * @Description: 住户数据模型
 * @author JunX
 */

@Entity
@Table(name = "plat_household")
@JsonIgnoreProperties({"houses", "positions", "attences", "wagess", "charges"})
public class Household implements java.io.Serializable {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long householdId;

    /**
     * 员工号
     */
    @Column(nullable = false)
    private String householdNo;


    /**
     * 姓名
     */
    @Column(nullable = false)
    private String householdName;

    /**
     * 性别
     */
    @Column(nullable = false)
    private Integer householdSex;

    @Transient
    private String householdSexString;

    /**
     * 手机号码
     */
    @Column
    private String householdPhone;

    /**
     * 邮箱
     */
    @Column
    private String householdEmail;

    /**
     * 职业
     */
    @Column
    private String householdJob;

    /**
     * 年龄
     */
    @Column(nullable = false)
    private String householdAge;

    /**
     * 身份证号
     */
    @Column(nullable = false)
    private String householdIDCard;

    /**
     * 学历
     */
    @Column
    private String householdEducation;

    /**
     * 兴趣爱好
     */
    @Column
    private String householdHobby;

    /**
     * 入职时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(nullable = false)
    private Date householdCreateTime;

    /**
     * 是否职工
     */
    @Column(nullable = false)
    private Integer isWorker;

    /**
     * 是否住户
     */
    @Column(nullable = false)
    private Integer isHousehold;

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "plat_household_position", joinColumns = { @JoinColumn(name = "householdId") }, inverseJoinColumns ={@JoinColumn(name = "positionId") })
    private List<Position> positions;

    @Transient
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "household")
    private List<House> houses;

    @Transient
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "household")
    private List<Attence> attences;

    @Transient
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "household")
    private List<Wages> wagess;

    @Transient
    @OneToMany(fetch = FetchType.LAZY, mappedBy = "household")
    private List<Charge> charges;

    public Household() {

    }

    public Long getHouseholdId() {
        return householdId;
    }

    public void setHouseholdId(Long householdId) {
        this.householdId = householdId;
    }

    public String getHouseholdNo() {
        return householdNo;
    }

    public void setHouseholdNo(String householdNo) {
        this.householdNo = householdNo;
    }

    public String getHouseholdName() {
        return householdName;
    }

    public void setHouseholdName(String householdName) {
        this.householdName = householdName;
    }

    public Integer getHouseholdSex() {
        return householdSex;
    }

    public void setHouseholdSex(Integer householdSex) {
        this.householdSex = householdSex;
    }

    public String getHouseholdSexString() {
        return householdSexString;
    }

    public void setHouseholdSexString(String householdSexString) {
        this.householdSexString = householdSexString;
    }

    public String getHouseholdPhone() {
        return householdPhone;
    }

    public void setHouseholdPhone(String householdPhone) {
        this.householdPhone = householdPhone;
    }

    public String getHouseholdEmail() {
        return householdEmail;
    }

    public void setHouseholdEmail(String householdEmail) {
        this.householdEmail = householdEmail;
    }

    public String getHouseholdJob() {
        return householdJob;
    }

    public void setHouseholdJob(String householdJob) {
        this.householdJob = householdJob;
    }

    public String getHouseholdAge() {
        return householdAge;
    }

    public void setHouseholdAge(String householdAge) {
        this.householdAge = householdAge;
    }

    public String getHouseholdIDCard() {
        return householdIDCard;
    }

    public void setHouseholdIDCard(String householdIDCard) {
        this.householdIDCard = householdIDCard;
    }

    public String getHouseholdEducation() {
        return householdEducation;
    }

    public void setHouseholdEducation(String householdEducation) {
        this.householdEducation = householdEducation;
    }

    public String getHouseholdHobby() {
        return householdHobby;
    }

    public void setHouseholdHobby(String householdHobby) {
        this.householdHobby = householdHobby;
    }

    public Date getHouseholdCreateTime() {
        return householdCreateTime;
    }

    public void setHouseholdCreateTime(Date householdCreateTime) {
        this.householdCreateTime = householdCreateTime;
    }

    public Integer getIsWorker() {
        return isWorker;
    }

    public void setIsWorker(Integer isWorker) {
        this.isWorker = isWorker;
    }

    public Integer getIsHousehold() {
        return isHousehold;
    }

    public void setIsHousehold(Integer isHousehold) {
        this.isHousehold = isHousehold;
    }

    public List<Position> getPositions() {
        return positions;
    }

    public void setPositions(List<Position> positions) {
        this.positions = positions;
    }

    public List<House> getHouses() {
        return houses;
    }

    public void setHouses(List<House> houses) {
        this.houses = houses;
    }

    public List<Attence> getAttences() {
        return attences;
    }

    public void setAttences(List<Attence> attences) {
        this.attences = attences;
    }

    public List<Wages> getWagess() {
        return wagess;
    }

    public void setWagess(List<Wages> wagess) {
        this.wagess = wagess;
    }

    public List<Charge> getCharges() {
        return charges;
    }

    public void setCharges(List<Charge> charges) {
        this.charges = charges;
    }
}
